package com.javajun.entity;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;

/**
 * @className: Book
 * @description: 书籍实体类
 * @author: JavaJun
 * @date: 2018年11月20日
 */
@Entity
public class Book {

    private Integer id;
    // 书籍总数
    private Integer total;
    // 借出数量
    private Integer lend;
    // 书名
    private String name;
    // isbn
    private String isbn;
    // 作者
    private String author;
    // 作者简介
    private String authorIntro;
    // 目录
    private String catalog;
    // 出版日期
    private String pubdate;
    // 出版社
    private String publisher;
    // 总页数
    private String pages;
    // 小图
    private String smallimage;
    // 图片
    private String image;
    // 定价
    private String price;
    // 豆瓣链接
    private String alt;
    // 备注
    private String remark;
    // 书籍类别对象,@ManyToOne
    // private BookClass bookClass;

    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    /*@ManyToOne(fetch = FetchType.EAGER)
    public BookClass getBookClass() {
        return bookClass;
    }

    public void setBookClass(BookClass bookClass) {
        this.bookClass = bookClass;
    }*/

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(unique = true)
    public String getIsbn() {
        return isbn;
    }

    public void setIsbn(String isbn) {
        this.isbn = isbn;
    }

    @Lob
    @Basic(fetch = FetchType.LAZY)
    @Column(columnDefinition="TEXT")
    public String getAuthorIntro() {
        return authorIntro;
    }

    public void setAuthorIntro(String authorIntro) {
        this.authorIntro = authorIntro;
    }

    @Lob
    @Basic(fetch = FetchType.LAZY)
    @Column(columnDefinition="TEXT")
    public String getCatalog() {
        return catalog;
    }

    public void setCatalog(String catalog) {
        this.catalog = catalog;
    }

    public String getPubdate() {
        return pubdate;
    }

    public void setPubdate(String pubdate) {
        this.pubdate = pubdate;
    }

    public String getPublisher() {
        return publisher;
    }

    public void setPublisher(String publisher) {
        this.publisher = publisher;
    }

    public String getPages() {
        return pages;
    }

    public void setPages(String pages) {
        this.pages = pages;
    }

    public String getSmallimage() {
        return smallimage;
    }

    public void setSmallimage(String smallimage) {
        this.smallimage = smallimage;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getAlt() {
        return alt;
    }

    public void setAlt(String alt) {
        this.alt = alt;
    }

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    public Integer getLend() {
        return lend;
    }

    public void setLend(Integer lend) {
        this.lend = lend;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    @Override
    public String toString() {
        return "Book [id=" + id + ", total=" + total + ", lend=" + lend + ", name=" + name + ", isbn=" + isbn
                + ", author=" + author + ", authorIntro=" + authorIntro + ", catalog=" + catalog + ", pubdate="
                + pubdate + ", publisher=" + publisher + ", pages=" + pages + ", smallimage=" + smallimage + ", image="
                + image + ", price=" + price + ", alt=" + alt + ", remark=" + remark + "]";
    }

}
